#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int main() {
  int m, d;
  cin >> m >> d;
  int x = 31;
  if (m == 1) x = 31;
  if (m == 2) x = 28;
  if (m == 3) x = 31;
  if (m == 4) x = 30;
  if (m == 5) x = 31;
  if (m == 6) x = 30;
  if (m == 7) x = 31;
  if (m == 8) x = 31;
  if (m == 9) x = 30;
  if (m == 10) x = 31;
  if (m == 11) x = 30;
  if (m == 12) x = 31;
  x -= (8 - d);
  cout << 1 + (x + 6) / 7 << endl;
}
