#include <bits/stdc++.h>
const int INF = (int)1e9;
const long long MOD = (long long)1e9 + 7;
const long long LINF = (long long)4e18 + 20;
const long double PI = acos(-1.0);
const double EPS = 1e-9;
using namespace ::std;
long long ext_gcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long q = a / b;
  long long g = ext_gcd(b, a - q * b, x, y);
  x = x - q * y;
  swap(x, y);
  return g;
}
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
long long invMod(long long a, long long m = MOD) {
  long long x, y;
  ext_gcd(a, m, x, y);
  x %= m;
  if (x < 0) x += m;
  return x;
}
long long powMod(long long num, long long n, long long mod = (long long)MOD) {
  num %= mod;
  if (n == 0) {
    return (long long)1;
  }
  long long mul = num;
  long long ans = (long long)1;
  while (n) {
    if (n & 1) {
      ans = (ans * mul) % mod;
    }
    mul = (mul * mul) % mod;
    n >>= 1;
  }
  return ans;
}
template <class T>
vector<T> getDivisor(T n) {
  vector<T> v;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      v.push_back(i);
      if (i != n / i) {
        v.push_back(n / i);
      }
    }
  }
  sort(v.begin(), v.end());
  return v;
}
template <class T>
void UNIQUE(vector<T>& vec) {
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
}
long long bitcount64(long long bits) {
  bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555);
  bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333);
  bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f);
  bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff);
  bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff);
  return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff);
}
struct edge_base {
  int to;
  long long cost;
};
edge_base make_edge_base(int to, long long cost) {
  edge_base ret = {to, cost};
  return ret;
}
template <class T, class EDGE>
void dijkstra(int root, int V, vector<T>& dist, vector<int>& prev,
              vector<vector<EDGE> > G) {
  priority_queue<pair<T, int>, vector<pair<T, int> >, greater<pair<T, int> > >
      que;
  dist.assign(V, LINF);
  prev.assign(V, -1);
  dist[root] = 0;
  que.push(pair<T, int>(0, root));
  while (!que.empty()) {
    pair<T, int> p = que.top();
    que.pop();
    int v = p.second;
    if (dist[v] < p.first) continue;
    for (int i = 0; i < (int)G[v].size(); ++i) {
      EDGE e = G[v][i];
      if (dist[e.to] > dist[v] + e.cost) {
        dist[e.to] = dist[v] + e.cost;
        prev[e.to] = v;
        que.push(pair<T, int>(dist[e.to], e.to));
      }
    }
  }
}
vector<int> get_path(vector<int>& prev, int t) {
  vector<int> path;
  while (t != -1) {
    path.push_back(t);
    t = prev[t];
  }
  reverse(path.begin(), path.end());
  return path;
}
void warshall_floyd(vector<vector<long long> >& dist, int V,
                    const long long inf = LINF) {
  for (int k = 0; k < V; ++k) {
    for (int i = 0; i < V; ++i) {
      if (dist[i][k] >= inf) continue;
      for (int j = 0; j < V; ++j) {
        if (dist[k][j] >= inf) continue;
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
}
namespace FLOW {
struct edge_flow : public edge_base {
  long long cap;
  int rev;
};
edge_flow make_edge_flow(int to, long long cap, int rev, long long cost = 1) {
  edge_flow ret;
  ret.to = to;
  ret.cost = cost;
  ret.cap = cap;
  ret.rev = rev;
  return ret;
}
class Graph {
 public:
  int V;
  vector<vector<FLOW::edge_flow> > G;
  vector<long long> dist;
  vector<int> iter;
  vector<bool> used;
  void init(int v) {
    V = v;
    G.resize(V);
  }
  void reset() {
    iter.assign(V, 0);
    used.assign(V, false);
  }
  void add_edge(int from, int to, long long cap) {
    G[from].push_back(FLOW::make_edge_flow(to, cap, G[to].size()));
    G[to].push_back(FLOW::make_edge_flow(from, 0, G[from].size() - 1));
  }

 private:
  void bfs(int s) {
    queue<int> que;
    dist = vector<long long>(V, -1);
    dist[s] = 0;
    que.push(s);
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (int i = 0; i < (int)G[v].size(); ++i) {
        edge_flow& e = G[v][i];
        if (e.cap > 0 && dist[e.to] < 0) {
          dist[e.to] = dist[v] + 1;
          que.push(e.to);
        }
      }
    }
  }

 private:
  long long dfs(int v, int t, long long f) {
    if (v == t) return f;
    for (int& i = iter[v]; i < (int)G[v].size(); ++i) {
      FLOW::edge_flow& e = G[v][i];
      if (e.cap > 0 && dist[v] < dist[e.to]) {
        long long d = this->dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          G[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

 public:
  long long max_flow(int s, int t) {
    long long flow = 0;
    for (;;) {
      this->bfs(s);
      if (dist[t] < 0) return flow;
      iter = vector<int>(V, 0);
      long long f = this->dfs(s, t, LINF);
      do {
        flow += f;
        f = this->dfs(s, t, LINF);
      } while (f > 0);
    }
  }
};
}  // namespace FLOW
bool is_bipartite(int v, int c, vector<vector<int> >& G, vector<int>& Color) {
  Color[v] = c;
  for (int i = 0; i < (int)G[v].size(); ++i) {
    if (Color[G[v][i]] == c) return false;
    if (Color[G[v][i]] == 0 && !is_bipartite(G[v][i], -c, G, Color)) {
      return false;
    }
  }
  return true;
}
bool is_bipartite(int Root, vector<vector<int> >& Graph) {
  int GraphSize = Graph.size();
  vector<int> Color(GraphSize, 0);
  const int ColorNo = 1;
  return is_bipartite(Root, ColorNo, Graph, Color);
}
namespace matching {
int V;
vector<vector<int> > G;
vector<int> match;
vector<bool> used;
void add_edge(int u, int v) {
  G[u].push_back(v);
  G[v].push_back(u);
}
bool dfs(int v) {
  used[v] = true;
  int size = G[v].size();
  for (int i = 0; i < size; ++i) {
    int u = G[v][i];
    int w = match[u];
    if (w < 0 || ((used[w] == false) && dfs(w))) {
      match[v] = u;
      match[u] = v;
      return true;
    }
  }
  return false;
}
int bipartite_matching() {
  int res = 0;
  match = vector<int>(V, -1);
  for (int v = 0; v < V; ++v) {
    if (match[v] < 0) {
      used = vector<bool>(V, false);
      if (dfs(v)) {
        ++res;
      }
    }
  }
  return res;
}
}  // namespace matching
vector<vector<long long> > NCK;
void makeinv(vector<long long>& inv, const long long P) {
  int i;
  const int varMAX = max(300010, (int)inv.size());
  inv = vector<long long>(varMAX + 1, 0);
  inv[1] = 1;
  for (i = 2; i <= varMAX; i++) {
    inv[i] = (inv[P % i] * (P - P / i) % P) % P;
  }
}
long long nCk(long long N, long long k, long long mod = MOD) {
  static vector<long long> inv;
  if (inv.size() == 0) {
    makeinv(inv, mod);
  }
  k = min(k, N - k);
  if (k < 0 || k > N) {
    return 0;
  }
  if (k == 0) {
    return 1;
  }
  if (k == 1) {
    return N % mod;
  }
  long long ret = 1;
  for (int i = 1; i <= k; ++i) {
    ret = (ret * ((N + 1 - i) % mod)) % mod;
    ret = (ret * inv[i]) % mod;
  }
  return ret;
}
long long nCk_once(long long N, long long k, long long mod = MOD) {
  k = min(k, N - k);
  if (k < 0 || k > N) {
    return 0;
  }
  if (k == 0) {
    return 1;
  }
  if (k == 1) {
    return N % mod;
  }
  long long ret = 1;
  long long A = 1;
  for (long long i = 0; i < k; ++i) {
    A = (A * ((N - i) % mod)) % mod;
  }
  long long B = 1;
  for (long long i = 2; i <= k; ++i) {
    B = (B * (i % mod)) % mod;
  }
  ret = (A * powMod(B, mod - 2, mod)) % mod;
  return ret;
}
long long nCk_base(int N, int K, long long mod = MOD) {
  if (K < 0 || N < K) return 0;
  K = min(K, N - K);
  if (K == 0) {
    return 1 % mod;
  }
  if (K == 1) {
    return N % mod;
  }
  if (N <= 10000 && NCK[N][K]) {
    return NCK[N][K];
  }
  long long ans = (nCk_base(N - 1, K) + nCk_base(N - 1, K - 1)) % mod;
  if (N <= 10000) {
    NCK[N][K] = ans;
  }
  return ans;
}
class UnionFind {
 public:
  int cNum;
  vector<int> parent;
  vector<int> count;
  vector<vector<int> > GList;
  UnionFind(int n) {
    cNum = n;
    parent = vector<int>(n);
    count = vector<int>(n, 1);
    GList.resize(n);
    for (int i = 0; i < n; ++i) {
      parent[i] = i;
      GList[i].push_back(i);
    }
  }
  int find(int x) {
    if (parent[x] == x) {
      return x;
    }
    return parent[x] = find(parent[x]);
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int Count(int x) { return count[find(x)]; }
  void add(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    parent[x] = y;
    count[y] += count[x];
    if (GList[y].size() < GList[x].size()) {
      swap(GList[x], GList[y]);
    }
    GList[y].insert(GList[y].end(), GList[x].begin(), GList[x].end());
  }
};
class BITree {
  int N;
  vector<long long> bit;

 public:
  BITree(int n) {
    N = n;
    bit = vector<long long>(N + 1, 0);
  }
  void add(int a, long long w) {
    if (a <= 0 || N < a) return;
    for (int i = a; i <= N; i += i & -i) {
      bit[i] += w;
    }
  }
  long long sum(int a) {
    long long ret = 0;
    if (a > N) a = N;
    for (int i = a; i > 0; i -= i & -i) {
      ret += bit[i];
    }
    return ret;
  }
};
template <typename T>
class segmentTree {
  int N;
  vector<T> dat1;
  T VAL_E;
  T VAL_NULL;

 public:
  segmentTree(){};
  void init(int n, T val_E, T val_N) {
    N = n;
    VAL_E = val_E;
    VAL_NULL = val_N;
    int size = 2;
    while (size < N) {
      size <<= 1;
    }
    N = size;
    dat1.resize(2 * N);
    dat1.assign(2 * N, val_E);
  }
  T SELECT(T L, T R) {
    T ans;
    ans = max(L, R);
    return ans;
  }
  void update(int i, T val) {
    i += N - 1;
    dat1[i] = val;
    while (i > 0) {
      i = (i - 1) / 2;
      dat1[i] = SELECT(dat1[i * 2 + 1], dat1[i * 2 + 2]);
    }
  }
  T query(int a, int b, int k, int L, int R) {
    if (R <= a || b <= L) {
      return VAL_E;
    }
    if (a <= L && R <= b && dat1[k] != VAL_NULL) {
      return dat1[k];
    }
    T res = VAL_E;
    int mid = (L + R) / 2;
    if (a < mid) res = SELECT(res, query(a, b, k * 2 + 1, L, mid));
    if (mid < b) res = SELECT(res, query(a, b, k * 2 + 2, mid, R));
    return res;
  }
  T query(int L, int R) { return query(L, R, 0, 0, N); }
};
namespace mymat {
long long matMOD = MOD;
};
template <class T>
vector<vector<T> > operator*(vector<vector<T> >& A, vector<vector<T> >& B) {
  long long mod = mymat::matMOD;
  int R = A.size();
  int cen = A[0].size();
  int C = B[0].size();
  vector<vector<T> > ans(R, vector<T>(C, 0));
  for (int row = 0; row < R; ++row) {
    for (int col = 0; col < C; ++col) {
      for (int inner = 0; inner < cen; ++inner) {
        ans[row][col] = (ans[row][col] + A[row][inner] * B[inner][col]) % mod;
      }
    }
  }
  return ans;
}
template <class T>
vector<vector<T> > powMod(const vector<vector<T> >& mat, long long N,
                          long long mod = MOD) {
  mymat::matMOD = mod;
  int R = mat.size();
  int C = mat[0].size();
  vector<vector<T> > I(R, vector<T>(C, 0));
  for (int i = 0; i < R && i < C; ++i) {
    I[i][i] = 1;
  }
  if (N == 0) {
    return I;
  }
  vector<vector<T> > mul(R, vector<T>(C)), ans(R, vector<T>(C));
  ans = I;
  mul = mat;
  while (N) {
    if (N & 1) {
      ans = ans * mul;
    }
    N >>= 1;
    mul = mul * mul;
  }
  return ans;
}
namespace TIME {
clock_t start, end;
void time_start() { start = clock(); }
void time_set(int t) { end = start + t; }
bool check() { return clock() < end; }
}  // namespace TIME
namespace RAND {
unsigned long xor128() {
  static unsigned long x = 123456789, y = 362436069, z = 521288629,
                       w = 88675123;
  unsigned long t;
  t = (x ^ (x << 11));
  x = y;
  y = z;
  z = w;
  return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
long long getRAND(long long P) { return ((xor128() % P) + P) % P; }
}  // namespace RAND
void solve() {
  int N;
  long long M;
  cin >> N >> M;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i < N; ++i) {
    long long sum = 0;
    for (int j = i; j < N; ++j) {
      sum += A[j];
      if (sum % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
signed main(void) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed;
  cout << setprecision(16);
  solve();
}
