import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc int length = S.length(); length S.length() S.length S String one = "1"; one "1" int flag = 0; flag 0 int F = 0; F 0 int B = 1; B 1 long locate = 1; locate 1 String Ma = "1"; Ma "1" for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		} int count = 1; int count = 1; count 1 flag == 0 && count <= length flag == 0 flag 0 count <= length count length count++ count++ count {
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		} {
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		} String compareX = S.substring(F,B); compareX S.substring(F,B) S.substring S F B if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			} one.equals(compareX) one.equals one compareX {
				F++;
				B++;
			} F++ F B++ B {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			} Ma = S.substring(F,B) Ma S.substring(F,B) S.substring S F B locate = B locate B flag = 1 flag 1 int ans = Integer.parseInt(Ma); ans Integer.parseInt(Ma) Integer.parseInt Integer Ma if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		} K < locate K locate {
			System.out.println(1);
		} System.out.println(1) System.out.println System.out System System.out 1 {
			System.out.println(ans);
		} System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		long K = sc.nextLong();
		
		
		int length = S.length();
		
		String one = "1";
		
		int flag = 0;
		int F = 0;
		int B = 1;
		long locate = 1;
		String Ma = "1";
		
		for (int count = 1; flag == 0 && count <= length; count++){
			String compareX = S.substring(F,B);
			if(one.equals(compareX)){
				F++;
				B++;
			}else {
				Ma = S.substring(F,B);
				locate = B;
				flag = 1;
			}
		}
		int ans = Integer.parseInt(Ma);
		
		
		if(K < locate){
			System.out.println(1);
		}
		else{
			System.out.println(ans);
		}
		
		
	}
}