#include <bits/stdc++.h>
using namespace std;
int main() {
  int month, day;
  int cheat[13] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  cin >> month >> day;
  int n = cheat[month] - 8 + day;
  int ans = 1 + (n / 7) + ((n % 7) > 0);
  cout << ans;
  return 0;
}
