#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, M;
  cin >> N >> M;
  vector<long> A(N);
  long count = 0;
  long a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = 0; j < i + 1; j++) {
      A.at(j) += a;
      if (A.at(j) % M == 0) {
        count++;
        cout << j + 1 << i + 1 << endl;
      }
    }
  }
  cout << count << endl;
}
