include [HTML_REMOVED]
int arr[100010];
int arr2[100010];
using namespace std;
int main()
{
int n, m,l,r;
scanf(“%d%d”,&n,&m);
for (int i = 0; i < n; i)
scanf(“%d”, &arr[i]);
arr2[0] = arr[0];
for (int i = 0; i < n-1; i)
arr2[i + 1] = arr2[i] + arr[i + 1];
while (m–)
{
scanf(“%d%d”, &l, &r);
cout << arr2[r-1] - arr2[l-2] << endl;
}
return 0;
}