#include <bits/stdc++.h>
using namespace ::std;
int main() {
  ifstream fin("input.txt");
  vector<int> monlen = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int m, d;
  cin >> m >> d;
  cout << (monlen[m - 1] + d - 1 + 6) / 7 << "\n";
}
