#include <bits/stdc++.h>
const int N = 1000010;
using namespace std;
int m[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int a, b;
  cin >> a >> b;
  cout << (b - 1 + m[a - 1] + 6) / 7;
}
