#include <bits/stdc++.h>
using namespace std;
bool okay(vector<int> &moto, int i, int j, int &S) {
  int k = 0;
  for (int l = i; l <= j; l++) {
    k += moto.at(l);
  }
  if (k == S)
    return true;
  else
    return false;
}
int main() {
  int N, S, a = 0;
  cin >> N >> S;
  vector<int> moto(N);
  for (int i = 0; i < N; i++) cin >> moto.at(i);
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (okay(moto, i, j, S)) {
        cout << i + 1 << " " << j + 1 << endl;
        a += (i + 1) * (N - j);
      }
    }
  }
  cout << a << endl;
}
