#include <bits/stdc++.h>
using namespace std;
bool m[16000005], r[16000005];
int acc[2001], a[2000];
set<int> s;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", acc + i), acc[i] += acc[i - 1];
  for (int i = 0; i < k; ++i) scanf("%d", a + i), m[a[i] + 8000002] = 1;
  for (int j = 1; j <= n; ++j) {
    int c = 0;
    for (int e = 1; e <= n; ++e) {
      int y = a[0] + acc[e] - acc[j] + 8000002;
      c += m[y] && r[y] != 1;
      r[y] = 1;
    }
    for (int e = 1; e <= n; ++e) {
      int y = a[0] + acc[e] - acc[j] + 8000002;
      r[y] = 0;
    }
    if (c >= k) s.insert(a[0] + acc[j]);
  }
  cout << s.size();
}
