#include <bits/stdc++.h>
template <class T>
inline T gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  if (!b) return a;
  return __gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / __gcd(a, b)) * b;
}
template <class T>
inline T ncr(T n, T r) {
  return n * (n - 1) / r;
}
using namespace std;
int main() {
  int ar[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int m, d;
  cin >> m >> d;
  int md = ar[m - 1];
  md += (d - 1);
  int ans = md / 7;
  if (md % 7 != 0) ans++;
  cout << ans;
  return 0;
}
