#include <bits/stdc++.h>
using namespace std;
long long int a[100009];
long long int b[100009];
long long int sum[100009];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < k; ++i) cin >> b[i];
  sum[0] = a[0];
  for (int i = 1; i < n; ++i) sum[i] = sum[i - 1] + a[i];
  set<long long int> init;
  for (int i = 0; i < n; ++i) {
    init.insert(b[0] - sum[i]);
  }
  int ans = 0;
  for (auto v : init) {
    map<long long int, int> m;
    for (int i = 0; i < n; ++i) {
      m[v + sum[i]] = 1;
    }
    int flag = 1;
    for (int i = 0; i < k; ++i) {
      if (m.find(b[i]) == m.end()) {
        flag = 0;
        break;
      }
    }
    if (flag) ans++;
  }
  cout << ans << endl;
}
