#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long s[100005];
int main() {
  long long n, m;
  while (cin >> n >> m) {
    memset(a, 0, sizeof(a));
    memset(s, 0, sizeof(s));
    int t = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      if (i == 0)
        s[i] = a[i];
      else {
        s[i] = a[i] + s[i - 1];
      }
      if (s[i] % m == 0) {
        t++;
      }
    }
    for (int i = 0; i < n - 1; i++) {
      for (int j = i + 1; j < n; j++) {
        if ((s[j] - s[i]) % m == 0) {
          t++;
        }
      }
    }
    cout << t << endl;
  }
  return 0;
}
