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