#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
using namespace std;
int main() {
  int m, d;
  cin >> m >> d;
  d--;
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 12 || m == 10) {
    d = d + 31;
  } else if (m != 2) {
    d = d + 30;
  } else {
    d = d + 28;
  }
  cout << d / 7 + (d % 7 != 0);
}
