#include <bits/stdc++.h>
using namespace std;
int t[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int n, m;
  cin >> n >> m;
  int x = m - 1 + t[n];
  if (x % 7)
    cout << (x / 7) + 1;
  else
    cout << x / 7;
}
