#include <bits/stdc++.h>
using namespace std;
long long a[100000], b[100001];
int comb(int x, int y) {
  int ret = 1;
  for (int i = 0; i < y; i++) {
    ret *= x - i;
  }
  return ret / 2;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  b[0] = 0;
  for (int i = 0; i < n; i++) b[i + 1] = a[i] + b[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int x = b[i] % m;
    for (int j = i + 1; j < n + 1; j++) {
      if (x == b[j] % m) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
