#include <bits/stdc++.h>
using namespace std;
long long int a[100010], ans, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    a[i] = (a[i] + a[i - 1]) % m;
    if (!a[i]) ans++;
  }
  for (int l = 1; l <= n; l++) {
    for (int r = l + 1; r <= n; r++) {
      a[r] = (a[r] - a[l] + m) % m;
      if (!a[r]) ans++;
    }
  }
  cout << ans << endl;
}
