#include <bits/stdc++.h>
using namespace std;
bool need[8000010], rem[8000010];
int n, k, b[8000010], sum[8000010], minl = (int)1e9, out;
vector<int> ans;
int main() {
  scanf("%d%d", &k, &n);
  for (int i = 1; i <= k; i++) scanf("%d", &sum[i]), sum[i] += sum[i - 1];
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), minl = min(b[i], minl);
  for (int i = 1; i <= k; i++) ans.push_back(minl - sum[i]);
  for (int i = 0; i < ans.size(); i++) {
    for (int j = 1; j <= n; j++) need[b[j] + 4000000] = 1;
    int x = ans[i], tot = 0;
    if (rem[x] == 1) continue;
    rem[x] = 1;
    for (int j = 1; j <= k; j++) {
      tot += need[x + sum[j] + 4000000];
      need[x + sum[j] + 4000000] = 0;
    }
    if (tot == n) out++;
  }
  cout << out << endl;
  return 0;
}
