const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

// input
reader.on('line', function(line) {
  showInput(line)
});

const showInput = (line) => {
  const inputs = line.split(' ')
  let month = parseInt(inputs[0])
  let day = parseInt(inputs[1])
  let takahashiDayCount = 0

  if (month <= 0 || month >= 12) {
    return console.log(takahashiDayCount)
  }

  for (month; month > 0; month--) {
    if (month <= day) {
      takahashiDayCount++
    }
  }

  return console.log(takahashiDayCount)
}