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