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