#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  long long n, m, a, sum = 0, ans[100005] = {};
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> a;
    ans[i] = ans[i - 1] + a;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = i; j <= n; j++) {
      if ((ans[j] - ans[i - 1]) % m == 0) sum++;
    }
  }
  cout << sum << '\n';
  return 0;
}
