#include <bits/stdc++.h>
using namespace std;
int a[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int m, d;
  cin >> m >> d;
  int ans = ((d - 2 + a[m - 1]) / 7) + 1;
  cout << ans << endl;
  return 0;
}
