#include <bits/stdc++.h>
using namespace std;
const int MXN = (int)3e6 + 10;
const int INF = (int)1e9 + 7;
const long long LINF = (long long)1e18 + 10;
const double EPS = (double)1e-6;
const double PI = (double)acos(-1.0);
int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int m, d;
int main() {
  cin >> m >> d;
  cout << (month[m - 1] + d - 1 + 6) / 7;
  return 0;
}
