#include <bits/stdc++.h>
using namespace std;
const int maxn = 100004;
int c[maxn] = {0};
int n, m, k, ans = 0;
int sum(int l, int r) {
  if (r > l) swap(l, r);
  int j = 0;
  for (int i = l; i <= r; i++) j += c[i];
  return j;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (sum(i, j) % m == 0) {
        printf("%d:%d %d\n", j, i, sum(i, j));
        ans++;
      }
    }
  }
  cout << ans - 1;
}
