#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int cnt;
  int answer = 0;
  cin >> n >> m;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] %= m;
  }
  for (int i = 0; i < n - 1; i++) {
    cnt = a[i];
    cnt %= m;
    if (cnt == 0) {
      answer++;
    }
    for (int j = i + 1; j < n; j++) {
      cnt += a[j];
      cnt %= m;
      if (cnt == 0) {
        answer++;
      }
    }
  }
  cout << answer << endl;
  return 0;
}
