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