Problem:


Score: 100 points

Problem Statement

In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year.

For example, May 3, 2018 is written as 2018-5-3, or 5-3 without the year.  

In this country, a date is called Takahashi when the month and the day are equal as numbers. For example, 5-5 is Takahashi.

How many days from 2018-1-1 through 2018-a-b are Takahashi?

Constraints

a is an integer between 1 and 12 (inclusive).

b is an integer between 1 and 31 (inclusive).

2018-a-b is a valid date in Gregorian calendar.

Input

Input is given from Standard Input in the following format:

a b

Output

Print the number of days from 2018-1-1 through 2018-a-b that are Takahashi.

Sample Input 1

5 5

Sample Output 1

5

There are five days that are Takahashi: 1-1, 2-2, 3-3, 4-4 and 5-5.

Sample Input 2

2 1

Sample Output 2

1

There is only one day that is Takahashi: 1-1.

Sample Input 3

11 30

Sample Output 3

11

There are eleven days that are Takahashi: 1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 7-7, 8-8, 9-9, 10-10 and 11-11.



Sample input:
5 5


Sample output:
5

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def is_sosu(x):
    for i in range(2, x):
        if x % i == 0:
            return False
    return True


def is_gosei(x):
    for i in range(2, x):
        if x % i == 0:
            return True
    return False


def check(lis):
    for i in range(len(lis)):
        for j in range(i, len(lis)):
            for k in range(j, len(lis)):
                for l in range(k, len(lis)):
                    for m in range(l, len(lis)):
                        if is_gosei(lis[i] + lis[j] + lis[k] + lis[l] + lis[m]):
                            pass
                        else:
                            return False
    return True

N = int(input())
sosu = []
for candidate in range(2, 1000):
    if is_sosu(candidate):
        sosu.append(candidate)

for n in range(0, len(sosu)-N, N):
    if check(sosu[n:n + N]):
        print(' '.join([str(s) for s in sosu[n:n + N]]))
        break

Submission status: Runtime Error

Solution code:
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

n = int(input())

c = []
k=0
for i in range(n):
    
    while(not is_prime(5 * k + 2)):
        k = k + 1
    
    c.append(5 *k + 2)
    k=k+1

print(' '.join(map(str, c)))

Submission status: Runtime Error

Solution code:
K = int(input())
max_index = numbers.index(max(numbers))
result = [numbers[i] * 2 ** K if i == max_index else numbers[i] for i in range(len(numbers))]
print(sum(result))

Submission status: Runtime Error

Solution code:
n = int(input())
import math
import random
s = [1 for i in range(55555+1)]
s[0], s[1] = 0, 0
for i in range(2, int(math.sqrt(55555))+1):
    if s[i] != 0:
        for j in range(i*2, 55555, i):
            s[j] = 0
prime = []
for i in range(55555+1):
    if s[i] == 1:
        prime.append(i)

def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1








while True:
    a = random.sample(prime, n)
    count = 0
    while True:
        b = random.sample(a, 5)
        if is_prime(sum(b)):
            break
        else:
            count += 1
        if count > 30:
            ans = ''
            for i in a:
                ans += str(i) + ' '
            print(ans[:-1])
            # print(sum(a))
            # print(is_prime(sum(a)))
            quit()

Submission status: Runtime Error

Solution code:
#include <stdio.h>

int main(void) {
    int a, b;

    scanf("%d %d", &a, &b);

    if (a <= b) {
        printf("%d\n", a);
    }
    else {
        printf("%d\n", b);
    }

    return 0;
}

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np


def check1(b: list):
    """
    FalseならOK
    Args:
        b:

    Returns:

    """
    for idx, num in enumerate(b[:-1]):
        return num in b[idx + 1:]


def check2(b: list):
    """
    FalseならOK
    Args:
        b:

    Returns:

    """
    return True in [is_prime(int(np.sum(np.array(i)))) for i in itertools.combinations(b, 5)]



def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False
    return pow(2, q - 1, q) == 1


if __name__ == '__main__':

    num_list = []
    size = int(input())
    while len(num_list) != size:
        x = np.random.randint(1000)
        if is_prime(x):
            num_list.append(x)
            if len(num_list) >= 2:
                if not check1(num_list):
                    if len(num_list) >= 5:
                        if not check2(num_list):
                            continue
                        else:
                            del num_list[len(num_list) - 1]
                else:
                    del num_list[len(num_list) - 1]

    print(' '.join(map(str, num_list)))

Submission status: Runtime Error

Solution code:
H, W = (int(i) for i in input().split())
t = []
t.append(['.']*(H+2))

for j in range(H):
	tmp = input()
	tmp = '.' + tmp + '.'
	t.append(list(tmp))

t.append(['.']*(H+2))

def CheckBlock(i,k):
	if t[i][k-1] == '#': #check up
		return 0
	elif t[i-1][k] == '#': #check left
		return 1
	elif t[i+1][k] == '#': #check right
		return 2
	elif t[i][k+1] == '#': #check down
		return 3
	else:
		return 4

for i in range(1,W+1):
	for k in range(1,H+1):
		if t[i][k] == '#':
			marker = CheckBlock(i,k)
			if marker == 4:
				print('No')
				quit()
print('Yes')

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())


takahashi = 0
 
# till last month
for x in range(1, a-1):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(i, b+1):
    if x == a:
        takahashi += 1
print(takahashi)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

a, b = 12, 10


takahashi = 0
 
# till last month
for x in range(1, a-1):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(i, b+1):
    if x == a:
        takahashi += 1
print(takahashi)

Submission status: Runtime Error

Solution code:
# https://abc096.contest.atcoder.jp/tasks/abc096_d

import itertools


def is_prime(n):
    if n < 2: return False
    if n == 2: return True
    if n % 2 == 0: return False

    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1

    return True


N = int(input())


l = []

n = 2
while len(l) < N * 3:
    if is_prime(n):
        l.append(n)
    n += 1


for a in itertools.combinations(l, N):
    # print(a)
    is_ok = True
    for c in itertools.combinations(a, 5):
        if is_prime(sum(c)):
            # print(str(c) + ' is prime = ' + str(sum(c)))
            is_ok = False
            break
    if is_ok:
        print(' '.join(map(str, a)))
        break

Submission status: Runtime Error

Solution code:
n = input().split()

n = [int(n[0]), int(n[1])]
H = n[0]
W=n[1]

s = [list(map(str, input().split())) for i in range(H)]

c = True
for i in range(H):
    for j in range(W):
        if(s[i][0][j] == '#'):
            if(i == 0):
                if(j == 0):
                    if(s[i + 1][0][j] == '.' and s[i][0][j + 1] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i+1][0][j ] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
                else:
                     if(s[i + 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
            elif(i == H - 1):
                if(j == 0):
                    if(s[i - 1][0][j] == '.' and s[i][0][j +1] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i-1][0][j] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
                else:
                     if(s[i - 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
            else:
                if(j == 0):
                    if(s[i - 1][0][j] == '.' and s[i][0][j +1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i-1][0][j] == '.' and s[i][0][j-1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                else:
                     if(s[i - 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                
    
if(c):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
K = int(input())

testA = 0
if testA < a:
    testA = a
if testA < b:
    testA = b
if testA < c:
    testA = c
  
ans = a + b + c + testA * (K-1)
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  5 20:54:36 2018

@author: sakas
"""

X = int(input().strip())
Y = int(input().strip())

if X > Y:
    print(X - 1)
else:
    print(X)

Submission status: Runtime Error

Solution code:
n = input().split()

n = [int(n[0]), int(n[1])]
H = n[0]
W=n[1]

s = [list(map(str, input().split())) for i in range(H)]
print(s[0][0][1])
c = True
for i in range(H):
    for j in range(W):
        if(s[i][0][j] == '#'):
            if(i == 0):
                if(j == 0):
                    if(s[i + 1][0][j] == '.' and s[i][0][j + 1] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i+1][0][j ] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
                else:
                     if(s[i + 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
            elif(i == H - 1):
                if(j == 0):
                    if(s[i - 1][0][j] == '.' and s[i][0][j +1] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i-1][0][j] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
                else:
                     if(s[i - 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.'):
                        c = False
                        break
            else:
                if(j == 0):
                    if(s[i - 1][0][j] == '.' and s[i][0][j +1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                elif(j == W - 1):
                    if(s[i-1][0][j] == '.' and s[i][0][j-1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                else:
                     if(s[i - 1][0][j] == '.' and s[i][0][j + 1] == '.' and s[i][0][j-1] == '.' and s[i + 1][0][j] == '.'):
                        c = False
                        break
                
    
if(c):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x = list(map(int,input().split()))
h = x[0]
w = x[1]
can = list()
for i in range(h):
    y = input()
    can.append(y)
z = 0
for i in range(h):
    for j in range(w):
        if can[i][j] == "#":
            if i > 0:
                if can[i - 1][j] == "#":
                    break
            if i < h - 1:
                if can[i + 1][j] == "#":
                    break
            if j > 0:
                if can[i][j - 1] == "#":
                    break
            if j < w - 1:
                if can[i][j + 1] == "#":
                    break
            z += 1
if z == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a, b = int (input())
takahashi = 0

for x in range(1, a+1):
    for y in range(1, b+1):
        if x == y:
            takahashi += 1

print(takahashi)

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())  # 入力
k = int(input())  # 入力
num_ary = [a, b, c]
max_n = max(num_ary)

max_index = num_ary.index(max_n)#最大値のindex

max_num = max_n * pow(2, k)

num_ary[max_index] = max_num

print(num_ary[0] + num_ary[1] + num_ary[2])

Submission status: Runtime Error

Solution code:
def solve(g):
    for i in range(1, h+1):
        for j in range(1, w+1):
            if g[i][j] == '#' and g[i][j+1] == '.' \
                    and g[i+1][j] == '.' and g[i][j-1] == '.' \
                    and g[i-1][j] == '.':
                        return False
    return True

h, w = list(map(int, input().split()))
g = [['.']*(w+2)]
g += [['.'] + list(input()) + ['.'] for i in range(h)]
g.append(['.']*(w+2))

if solve(g):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)
h,w = map(int,input().split())
lst = []
for i in range(h):
  lst.append([s for s in input()])
def dfs(x,y):
  if lst[x][y] == '#':
    lst[x][y] = '.'
    if x + 1 <= h - 1:
      dfs(x + 1,y)
    if x - 1 >= 0:
      dfs(x - 1,y)
    if y + 1 <= w - 1:
      dfs(x, y + 1)
    if y - 1 >= 0:
      dfs(x,y - 1)
flag = True
for i in range(h):
  for j in range(w):
    if lst[i][j] == '#':
      if (i - 1 >= 0 and lst[i - 1][j] == "#") or (i + 1 < h and lst[i + 1][j] == "#") or (j - 1 >= 0 and lst[i][j - 1] == "#") or (j + 1 < w and lst[i][j + 1] == "#"):
        dfs(i,j)
      else:
        flag = False
        break
if flag:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
H,W = input().split()
H,W = int(H),int(W)
nodes = [list(input()) for i in range(H)]


if H == 1 and W == 1 and nodes[0][0] == ".":
    print("No")
    quit()
if H == 1 and W == 1 and nodes[0][0] == "#":
    print("Yes")
    quit()


for i in range(H):
    for j in range(W):
        if nodes[i][j] == "#":
            flag = False
            if i - 1 >= 0:
                if nodes[i-1][j] == "#":
                    flag = True
            if i + 1 < H:
                if nodes[i+1][j] == "#":
                    flag = True
            if j - 1 >= 0:
                if nodes[i][j-1] == "#":
                    flag = True
            if j + 1 < W:
                if nodes[i][j+1] == "#":
                    flag = True

            if flag == False:
                print("No")
                quit()

print("Yes")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
a.sort()
k = int(input())
a[2] = a[2]*2**k
print(sum(a))

Submission status: Runtime Error

Solution code:
numbers = map(int, raw_input().split())
a = numbers[0]
b = numbers[1]
i = 1
while True:
    if a != i:
        i += 1
        continue
    else:
        if b < i:
            print(i - 1)
            break
        else:
            print(i)
            break

Submission status: Runtime Error

Solution code:
a,b=map(int(input()).split())
if a==1:
    print(1)
elif a==2 and b<=1:
    print(1)
elif a==2 and b>=2:
    print(2)
elif a==3 and b<=2:
    print(2)
elif a==3 and b>=3:
    print(3)
elif a==4 and b<=3:
    print(3)
elif a==4 and b>=4:
    print(4)
elif a==5 and b<=4:
    print(4)
elif a==5 and b>=5:
    print(5)
elif a==6 and b<=5:
    print(5)
elif a==6 and b>=6:
    print(6)
elif a==7 and b<=6:
    print(6)
elif a==7 and b>=7:
    print(7)
elif a==8 and b<=7:
    print(7)
elif a==8 and b>=8:
    print(8)
elif a==9 and b<=8:
    print(8)
elif a==9 and b>=9:
    print(9)
elif a==10 and b<=9:
    print(9)
elif a==10 and b>=10:
    print(10)
elif a==11 and b<=10:
    print(10)
elif a==11 and b>=11:
    print(11)
elif a==12 and b<=11:
    print(11)
else:
    print(12)

Submission status: Runtime Error

Solution code:
A = list(map(int,input().split()))
K = int(input())
 
A = A.sort
ans =A[0]+A[1]+A[2]*(2**K)

print(ans)

Submission status: Runtime Error

Solution code:
A = list(map(int,input().split()))
K = int(input())
 
A.sort()
print(A[0]+A[1]+A[2]*2**K)

Submission status: Runtime Error

Solution code:
a,b=map(int,raw_input().split())
it(a>b): print(a-1)
else: print a

Submission status: Runtime Error

Solution code:
A = list(map(int,input().split()))
K = int(input())
 
A.sort()
ans =A[0]+A[1]+A[2]*(2**K)

print(ans)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
K = int(input())

M = max(A, B, C)

SUM = M*(2**K)

if M == A:
	SUM+=(B+C)

if M == B:
	SUM+=(A+C)

if M == C:
	SUM+=(A+B)

print(SUM)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if 2*A > (B + C):
        A = A * 2
    elif 2*B > (A + C):
        B = B * 2
    elif 2*C > (B + A):
        C = C * 2
    elif A == B == C:
        A = A * 2

print(A+B+C)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
K = int(input())

M = max(A, B, C)

SUM = M*(2**K)

print(M)

if M == A:
	SUM+=(B+C)

if M == B:
	SUM+=(A+C)

if M == C:
	SUM+=(A+B)

print(SUM)

Submission status: Runtime Error

Solution code:
import sys
 
l1 = sys.stdin.readline()
l2 = sys.stdin.readline()
 
nums = [int(x) for x in l1.rstrip('\n').split(' ')]
l2 = int(l2)
 
out = max(nums)
 
for i in xrange(l2):
  out *= 2
print out + sum(nums) - max(nums)

Submission status: Runtime Error

Solution code:
def main(input):
  a, b = [int(i) for i in input.split()]
  print(a if a <= b else a-1)

# tests = [
#   '5 5',  # 5
#   '2 1',  # 1
#   '11 30',  # 11
# ]

# for test in tests:
#   main(test)


main(a, b)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
K = input()

M = max(A, B, C)

SUM = M*(2**K)

print(M)

if M == A:
	SUM+=(B+C)

if M == B:
	SUM+=(A+C)

if M == C:
	SUM+=(A+B)

print(SUM)

Submission status: Runtime Error

Solution code:
t  =int(input())
h =int(input())
a=13-t
if h>t:
	a=a-1
print(a)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
if a>=b:
	print(b)
else
	print(a)

Submission status: Runtime Error

Solution code:
Tmp = []
Tmp = input().rstrip().split(' ')

M = int(Tmp[0])
N = int(Tmp[1])

if M=<N:
    print(N)
else:
    print(N-1)

Submission status: Runtime Error

Solution code:
A, B, C = map(int, input().split())
K = int(input())
M = max([A, B, C])
print(M ** K + A + B+ C - M)

Submission status: Runtime Error

Solution code:
a, b = map(int, input.split(' '))
if a <= b:
	print(a)
else:
	print(a-1)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())

if a = b :
    print(a)
elif a > b:
    print(a-1)
elif a < b:
    print(a)

Submission status: Runtime Error

Solution code:
a,b=[int(x) for x input().split()]
if a<=b:
    print(a)
else:
    print(a-1)

Submission status: Runtime Error

Solution code:
a,b=map(int,input())
if a<=b:
  print(a)
else:
  print(a-1)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

#define INF 1000000000
#define pb(a) push_back(a)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x;
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < sz(v);i++)

int months[]={31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;
    REP(i,a-1){
        if(months[i]>=i)ans++;
    }
    if(b>=a)ans++;
    cout<<ans<<endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
 a,b = list(map(int,input().split()))     
 if a > b:                                
     print(a - 1)                         
 else:                                    
     print(a)c:w

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())

if a <= b:
    return a
else:
    return b

Submission status: Runtime Error

Solution code:
import sys

for l in sys.stdin:
  items = [int(x) for x in l.split(' ')]
  a = items[0]
  b = items[1]
  if a <= b:
    return a
  else:
    return a - 1

Submission status: Runtime Error

Solution code:

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;
	if (b > 13) b = 12;

	cout << min(a, b) << endl;

	return 0;
}

Submission status: Runtime Error

Solution code:
month, day = map(int, input())
if month > day:
    print(month-1)
else:
    print(month)

Submission status: Runtime Error

Solution code:
# n objects m seller 
# Write your code here
import math
a,b=map(int,input().split());
ans=a;
if a>b : 
    ans--;
print(ans);