Problem description

Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water any parts of the garden that were already watered, also she can't water the ground outside the garden.

Luba has to choose one of the buckets in order to water the garden as fast as possible (as mentioned above, each hour she will water some continuous subsegment of length ai if she chooses the i-th bucket). Help her to determine the minimum number of hours she has to spend watering the garden. It is guaranteed that Luba can always choose a bucket so it is possible water the garden.

See the examples for better understanding.

Input

The first line of input contains two integer numbers n and k (1 ≤ n, k ≤ 100) — the number of buckets and the length of the garden, respectively.

The second line of input contains n integer numbers ai (1 ≤ ai ≤ 100) — the length of the segment that can be watered by the i-th bucket in one hour.

It is guaranteed that there is at least one bucket such that it is possible to water the garden in integer number of hours using only this bucket.

Output

Print one integer number — the minimum number of hours required to water the garden.

Examples

Input

3 6
2 3 5

Output

2

Input

6 7
1 2 3 4 5 6

Output

7

Note

In the first test the best option is to choose the bucket that allows to water the segment of length 3. We can't choose the bucket that allows to water the segment of length 5 because then we can't water the whole garden.

In the second test we can choose only the bucket that allows us to water the segment of length 1.

解题思路:题目的意思就是有n个桶,选择其中一个长度为a(每小时可以浇的长度为a)的桶,使得刚好浇完长度为k的花园,要求浇过的不能再浇,求全程最短用时。结合提示可以知道,要刚好浇完长度为k的花园,必须选择a刚好被k整除的桶,这样最后才不会有重叠,并且a在所有桶长度中是k的较大因子,这样全程用时才最短。

AC代码:

 #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,x,mt=;
cin>>n>>k;
while(n--){
cin>>x;
if(k%x==)mt=min(mt,k/x);//取最短时间
}
cout<<mt<<endl;
return ;
}

D - Garden的更多相关文章

  1. HDU5977 Garden of Eden(树的点分治)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5977 Description When God made the first man, he ...

  2. hdu-5977 Garden of Eden(树分治)

    题目链接: Garden of Eden Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/ ...

  3. nginx+iis、NLB、Web Farm、Web Garden、ARR

    nginx+iis实现负载均衡 在win2008R2上使用(NLB)网络负载均衡 NLB网路负载均衡管理器详解 [译文]Web Farm和Web Garden的区别? IIS负载均衡-Applicat ...

  4. uva10001 Garden of Eden

    Cellular automata are mathematical idealizations of physical systems in which both space and time ar ...

  5. CF459A Pashmak and Garden (水

    Pashmak and Garden Codeforces Round #261 (Div. 2) A. Pashmak and Garden time limit per test 1 second ...

  6. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering

    Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...

  7. Web Farm 和Web Garden

    这两个都是提高网站性能的服务器端技术 1.Web Farm:如果应用程序被多个服务器托管,这种情况就可以称作Web Farm. 2.Web Garden: 指的是一个应用程序可以分成多个进程(w3wp ...

  8. Web Farm和Web Garden的区别

    在这篇博文中,我将确切剖析Web Farm和Web Garden的区别和原理,以及使用它们的利弊.进一步地,我将介绍如何在各个版本的IIS中创建Web Garden. 英文原文 | Abhijit J ...

  9. cf459A Pashmak and Garden

    A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standar ...

  10. bnu 34982 Beautiful Garden(暴力)

    题目链接:bnu 34982 Beautiful Garden 题目大意:给定一个长度为n的序列,问说最少移动多少点,使得序列成等差序列,点的位置能够为小数. 解题思路:算是纯暴力吧.枚举等差的起始和 ...

随机推荐

  1. js案例分析

    名字取的高大上,其实只是我平时上网浏览遇到的一些我感觉还不错的小题目,再加上我或者是我在网上找到的一些理解,就保存到这里了. 2019/4/2  最新开了个新坑,是一个javascipt30的一些案例 ...

  2. Python 索引切片

    #负数开头,只有比负数大才有数据 num = [1,2,3,4,5,6,7,8,9,10] print(num[-5:5]) num = [1,2,3,4,5,6,7,8,9,10] print(nu ...

  3. Django - 一对多数据示例

    1.增加Host -id 可以在模版中增加代码: 备注: 1.counter (从1开始) 2.counter0(从0开始) 3.revcounter(倒序) 4.revcounter0(倒序从0开始 ...

  4. node版本管理工具nvm安装使用教程

    一些安装包依赖一定的node版本,可以采用nvm管理node, 可以快速的进行版本切换. 操作系统: windows10, x64 常见版本工具: 1. nvmw, nvmm install node ...

  5. models中,对于(Small)IntegerField类型字段的choices参数在前端的展示

    # models.py class UserInfo(models.Model): gender_choices = ( (1, "男"), (2, "女"), ...

  6. JS练习:商品的左右选择

    代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title ...

  7. raspberry 重新烧录后的设置

    raspberry初学者在使用的时候经常遇到各种问题,常常重新烧录系统,现在把新系统的常用配置和安装内容整理一下,避免自己忘记 1.安装常用软件包: sudo apt-get gedit sudo a ...

  8. Eclipse中使用struts标签时出错

    原因是Action和ActionForm对应文件中没有继承相应的类,具体来说: ActionForm的编写: 必须继承org.apache.struts.action.ActionForm Actio ...

  9. Linux - centos7 下 MySQL(mariadb) 和 主从复制

    目录 Linux - centos7 下 MySQL(mariadb) 和 主从复制 MySQL(mariadb) 安装MySQL(mariadb) 配置数据库的中文支持 在远程用 mysql客户端去 ...

  10. linux学习6-简单的文本处理

    简单的文本处理 实验介绍 这一节我们将介绍这几个命令tr(注意不是tar),col,join,paste.实际这一节是上一节关于能实现管道操作的命令的延续,所以我们依然将结合管道来熟悉这些命令的使用. ...