"use strict";

const DEBUG_MODE = false;
const rawInput = DEBUG_MODE
  ? "1 1"
  : require("fs")
      .readFileSync("/dev/stdin", "utf8")
      .trim();
const YEAR = 2018;

const process = inputRaw => {
  const input = inputRaw.split(" ");
  const month = input[0];
  const day = input[1];

  console.log(day < month ? month - 1 : month);
};

process(rawInput);
