#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int, int> > qu2;
priority_queue<int> pq;
static const int NIL = -1;
static const int INF = 1000000007;
class UnionFind {
 public:
  vector<int> Parent;
  UnionFind(int n) { Parent = vector<int>(n, -1); }
  int root(int A) {
    if (Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]);
  }
  int size(int A) { return -Parent[root(A)]; }
  int connect(int A, int B) {
    A = root(A);
    B = root(B);
    if (A == B) {
      return false;
    }
    if (size(A) < size(B)) swap(A, B);
    Parent[A] += Parent[B];
    Parent[B] = A;
    return true;
  }
};
double dot_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).real();
}
double cross_product(complex<double> a, complex<double> b) {
  return (conj(a) * b).imag();
}
complex<double> projection(complex<double> p, complex<double> b) {
  return b * dot_product(p, b) / norm(b);
}
struct BIT {
  vector<int> dat;
  int sz;
  BIT(int n) {
    for (sz = 1; sz < n; sz *= 2)
      ;
    dat.resize(++sz);
  }
  int q(int n) {
    int ret = 0;
    for (int i = n; i > 0; i -= i & -i) ret += dat[i];
    for (int i = n; i < sz; i += i & -i) dat[i]++;
    return ret;
  }
};
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    a[i] %= m;
  }
  long long ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long temp = a[i];
    if (temp == 0) {
      ans++;
    }
    for (int j = i + 1; j < n; j++) {
      temp = (temp + a[j]) % m;
      if (temp == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
