#include <bits/stdc++.h>
using namespace std;
vector<long long> z_function(vector<long long> &s) {
  int n = (int)s.size();
  vector<long long> z(n);
  for (long long i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
void solve() {
  int n1, w1;
  long long n, w;
  scanf("%d %d", &n1, &w1);
  n = n1;
  w = w1;
  vector<long long> tempn, tempw;
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d ", &a);
    tempn.push_back(a);
  }
  for (int i = 0; i < w; ++i) {
    int a;
    scanf("%d ", &a);
    tempw.push_back(a);
  }
  vector<long long> ansv;
  for (int i = 1; i < tempw.size(); ++i) {
    ansv.push_back(tempw[i] - tempw[i - 1]);
  }
  ansv.push_back(2000000000);
  for (int i = 1; i < tempn.size(); ++i) {
    ansv.push_back(tempn[i] - tempn[i - 1]);
  }
  long long ans = 0;
  vector<long long> ans_z = z_function(ansv);
  for (int i = w; i < ansv.size(); ++i) {
    if (ans_z[i] >= w - 1) {
      ++ans;
    }
  }
  if (w == 1) {
    cout << n << endl;
  } else {
    cout << ans << endl;
  }
}
int main() {
  solve();
  return 0;
}
